package com.angel.mocks.data.generator.dataGenerator;

import java.io.InputStream;
import java.io.Serializable;

import com.angel.dao.generic.interfaces.GenericDAO;
import com.angel.data.generator.interfaces.DataGenerator;
import com.angel.data.generator.interfaces.impl.ImportFileDataGenerator;
import com.angel.io.descriptor.FileProcessorDescriptor;
import com.angel.io.processors.commands.impl.ExcelFileProcessorCommand;
import com.angel.io.processors.runners.imports.impl.ImportFileProcessorRunner;
import com.angel.io.separator.ColumnSeparator;

/**
 *
 * @author William
 */
public class CountryDataGenerator extends ImportFileDataGenerator{

	private static final long serialVersionUID = 2225441510475396657L;

	@SuppressWarnings("unchecked")
	public Class<? extends DataGenerator>[] getDependecesGenerators() {
        return (Class<? extends DataGenerator>[]) new Class[0];
    }

    public ImportFileProcessorRunner prepareImportFileProcessorRunner() {
		FileProcessorDescriptor descriptor = new FileProcessorDescriptor("USERs File", ColumnSeparator.COMMA);
		ImportFileProcessorRunner runner = new ImportFileProcessorRunner(descriptor,new ExcelFileProcessorCommand(), null);
//		ImportFileProcessorRunner runner = new ImportFileProcessorRunner(descriptor,new ExcelFileProcessorCommand(), new CountryRowProcessorCommand());
        runner.addAliasFor("name","Pais");
        runner.addAliasFor("locale","Locale");
        runner.addAliasFor("continent","Continente");
        return runner;
    }

    public InputStream prepareInputStream() {
//        try {
//            return StreamResourcesUtil.findInputStreamFor(ResourcesDataGeneratorsUtil.COUNTRIES_XLS_RESOURCE);
//        } catch (FileNotFoundException e) {
//            throw new DataGeneratorException("File not found [" + ResourcesDataGeneratorsUtil.COUNTRIES_XLS_RESOURCE + "].", e);
//        }
    	return null;
    }

    public Class<? extends Object> getDataGeneratorClass() {
        return Object.class;
    }

    public GenericDAO<Object, Serializable> getGenericDAO() {
        //return (GenericDAO<Object, Serializable>) ApplicationContextSpring.createInstance().prepareApplicationContext().getBean("countryDAO");
    	return null;
    }
}